//获取当前用户的状态 返回 员工信息
const app = getApp();
module.exports = () => {
  // let p = new Promise((resolve, reject) => {
  //   resolve(wx.getStorage('isEmployee'))
  // })
  // return p

  return app.$getData('/user/employee/is-employee').then(data => {
    if (data.errCode == 0) {
      let {
        employeeInfo = {},
        userInfo = {},
        isEmployee = false
      } = data.data || {};
      xhs.setStorage({
        key: 'employeeInfo',
        data: employeeInfo
      });
      xhs.setStorage({
        key: 'user',
        data: userInfo
      });
      return data.data;
    } else {
      xhs.showToast({
        icon: 'none',
        title: data.errInfo
      });
    }
  });
};